package com.cskaoyan.servlet;


import com.cskaoyan.bean.MarketOrder;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.service.AdminCollectService;
import com.cskaoyan.service.AdminCollectServiceImpl;
import com.cskaoyan.util.ResponseUtil;
import com.cskaoyan.util.StringUtil;
import lombok.SneakyThrows;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/admin/collect/*")

//小组接口会员收藏功能的实现

public class AdminCollectServlet extends WdBaseServlet {

    AdminCollectService adminCollectService= new AdminCollectServiceImpl();

    @SneakyThrows
    private void  list(HttpServletRequest request, HttpServletResponse response){


        Integer userId = StringUtil.isEmpty(request.getParameter("userId")) ? null : Integer.parseInt(request.getParameter("userId"));
        Integer valueId = StringUtil.isEmpty(request.getParameter("valueId")) ? null : Integer.parseInt(request.getParameter("valueId"));


        Integer page = StringUtil.isEmpty(request.getParameter("page")) ? null :Integer.parseInt(request.getParameter("page"));
        Integer limit = StringUtil.isEmpty(request.getParameter("limit")) ? null :Integer.parseInt(request.getParameter("limit"));
        String sort = request.getParameter("sort");
        String order = request.getParameter("order");
        CommonData<MarketOrder> commonData = adminCollectService.list(userId, valueId,  page, limit, sort, order);
        ResponseUtil.responseJson(response, BaseRespVo.ok(commonData));


    }

}
